home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8184 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: anvil.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Speed of random generators
  5. Date: 1 Mar 1996 12:23:16 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4h7mbkINNqkr@anvil.ugrad.cs.ubc.ca>
  8. References: <TAKAHASI.96Mar1113825@poisson.ece.cmu.edu>
  9. NNTP-Posting-Host: anvil.ugrad.cs.ubc.ca
  10.  
  11. In article <TAKAHASI.96Mar1113825@poisson.ece.cmu.edu>,
  12. Eduardo S. C. Takahashi <takahasi@poisson.ece.cmu.edu> wrote:
  13.  >
  14.  >I'm working in a simulation that requires intensive use of pseudo-random
  15.  >sequences. My problem is that profiling the program I found out that the
  16.  >generation of the sequences is responsible for about 50% of the total 
  17.  >execution time. Since each run can take about 4 hours, it would be good
  18.  >if I could save some time. 
  19.  
  20. If the simulation does not absolutely need a ``good'' random number generator,
  21. you can probably do with rand(). Good random generation is going to be more
  22. expensive, since you are updating a large accumulator, and doing more complex
  23. computation. 
  24.  
  25.  >Presently, I'm using the function erand48(), and I'm also making some 
  26.  >tests with ramdom(). If anyone has a suggestion I would really appreciate!
  27.  
  28.  
  29. -- 
  30.  
  31.